Get the label of current DispatchQueue
ChenZhijin
.com

Get the label of current DispatchQueue

Get the label of current DispatchQueue

1
2
3
4
5
6
import Foundation
public extension DispatchQueue {
  class var currentLabel: String {
      return String(validatingUTF8: __dispatch_queue_get_label(nil)) ?? ""
  }
}

and

1
2
import Foundation
print(DispatchQueue.currentLabel)
Tagged with: